// 封装权限模块的接口
// 导入request
import request from '@/utils/request.js';

// 获取权限
export function getPermissionList(params) {
  return request({
    url: '/sys/permission',
    params,
  });
}
// 新增权限
export function addPermission(data) {
  return request({
    url: '/sys/permission',
    method: 'post',
    data,
  });
}

// 编辑/更新权限
export function updatePermission(data) {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data,
  });
}

// 删除权限
export function delPermission(id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete',
  });
}
// 获取权限详情
export function getPermissionDetail(id) {
  return request({
    url: `/sys/permission/${id}`,
  });
}

// 给角色分配权限
export function assignPerm(data) {
  return request({
    method: 'PUT',
    url: '/sys/role/assignPrem',
    data,
  });
}

